#ifndef ENUM_CLASS_ALLOW_FLAGS_HPP
#define ENUM_CLASS_ALLOW_FLAGS_HPP


#include <type_traits>


namespace flags {


//template <class E, class Enabler = void> struct is_flags
//: public std::false_type {};

	template <typename T, typename = void>
	struct is_flags : std::false_type {};

	template <typename T>
	struct is_flags < T, decltype(__enumFlagsEnabled(T{})) > : std::true_type {};


} // namespace flags


//#define ALLOW_FLAGS_FOR_ENUM(name) \
//namespace flags { \
//template <> struct is_flags< name > : std::true_type {}; \
//}

#define with_flag(name) \
	name; \
	inline void __enumFlagsEnabled(name) {}; \
	typedef ::flags::flags<name> name##Flags; \
	enum class name
#define member_with_flag(name) \
	name; \
	friend inline void __enumFlagsEnabled(name) {}; \
	typedef ::flags::flags<name> name##Flags; \
	enum class name

#endif // ENUM_CLASS_ALLOW_FLAGS_HPP
